using System;
using System.Linq;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

namespace MaterialUI
{
	[ExecuteInEditMode]
	[AddComponentMenu("MaterialUI/Material Slider", 100)]
	public class MaterialSlider : UIBehaviour, ISelectHandler, IDeselectHandler, IPointerDownHandler, IPointerUpHandler, ILayoutGroup, ILayoutElement, IEventSystemHandler, ILayoutController
	{
		[SerializeField]
		private bool m_HasPopup = true;

		[SerializeField]
		private bool m_HasDots = true;

		[SerializeField]
		private float m_AnimationDuration = 0.5f;

		[SerializeField]
		private Color m_EnabledColor;

		[SerializeField]
		private Color m_DisabledColor;

		[SerializeField]
		private Color m_BackgroundColor;

		[SerializeField]
		private RectTransform m_SliderHandleTransform;

		[SerializeField]
		private Graphic m_HandleGraphic;

		private RectTransform m_HandleGraphicTransform;

		[SerializeField]
		private RectTransform m_PopupTransform;

		[SerializeField]
		private Text m_PopupText;

		[SerializeField]
		private Text m_ValueText;

		[SerializeField]
		private MaterialInputField m_InputField;

		[SerializeField]
		private RectTransform m_FillTransform;

		[SerializeField]
		private Graphic m_BackgroundGraphic;

		[SerializeField]
		private RectTransform m_LeftContentTransform;

		[SerializeField]
		private RectTransform m_RightContentTransform;

		[SerializeField]
		private RectTransform m_SliderContentTransform;

		[SerializeField]
		private RectTransform m_RectTransform;

		[SerializeField]
		private VectorImageData m_DotTemplateIcon;

		[SerializeField]
		private Graphic[] m_DotGraphics = new Graphic[0];

		[SerializeField]
		private int m_NumberOfDots;

		private RectTransform m_FillAreaTransform;

		private Slider m_Slider;

		private CanvasGroup m_CanvasGroup;

		private Canvas m_RootCanvas;

		private bool m_IsSelected;

		[SerializeField]
		private bool m_HasManualPreferredWidth;

		[SerializeField]
		private float m_ManualPreferredWidth = 200f;

		[SerializeField]
		private bool m_Interactable = true;

		[SerializeField]
		private bool m_LowLeftDisabledOpacity;

		[SerializeField]
		private bool m_LowRightDisabledOpacity;

		[SerializeField]
		private CanvasGroup m_LeftCanvasGroup;

		[SerializeField]
		private CanvasGroup m_RightCanvasGroup;

		private int m_HandleSizeTweener;

		private int m_PopupScaleTweener;

		private int m_HandleAnchorMinTweener;

		private int m_HandleAnchorMaxTweener;

		private int m_HandlePositionYTweener;

		private int m_PopupTextColorTweener;

		private DrivenRectTransformTracker m_Tracker = default(DrivenRectTransformTracker);

		private float m_Width;

		private float m_Height;

		private float m_LeftWidth;

		private float m_RightWidth;

		private float m_LastSliderValue;

		private float m_CurrentInputValue;

		public bool hasPopup
		{
			get
			{
				return m_HasPopup;
			}
			set
			{
				m_HasPopup = value;
			}
		}

		public bool hasDots
		{
			get
			{
				return m_HasDots;
			}
			set
			{
				m_HasDots = value;
			}
		}

		public float animationDuration
		{
			get
			{
				return m_AnimationDuration;
			}
			set
			{
				m_AnimationDuration = value;
			}
		}

		public Color enabledColor
		{
			get
			{
				return m_EnabledColor;
			}
			set
			{
				m_EnabledColor = value;
				if ((bool)m_HandleGraphic)
				{
					m_HandleGraphic.color = ((!m_Interactable) ? m_DisabledColor : m_EnabledColor);
				}
				for (int i = 0; i < m_DotGraphics.Length; i++)
				{
					if (!(m_DotGraphics[i] == null))
					{
						if (slider.value > (float)i)
						{
							m_DotGraphics[i].color = ((!m_Interactable) ? m_DisabledColor : m_EnabledColor);
						}
						else
						{
							m_DotGraphics[i].color = m_BackgroundColor;
						}
					}
				}
			}
		}

		public Color disabledColor
		{
			get
			{
				return m_DisabledColor;
			}
			set
			{
				m_DisabledColor = value;
				if ((bool)m_HandleGraphic)
				{
					m_HandleGraphic.color = ((!m_Interactable) ? m_DisabledColor : m_EnabledColor);
				}
				for (int i = 0; i < m_DotGraphics.Length; i++)
				{
					if (!(m_DotGraphics[i] == null))
					{
						if (slider.value > (float)i)
						{
							m_DotGraphics[i].color = ((!m_Interactable) ? m_DisabledColor : m_EnabledColor);
						}
						else
						{
							m_DotGraphics[i].color = m_BackgroundColor;
						}
					}
				}
			}
		}

		public Color backgroundColor
		{
			get
			{
				if (m_BackgroundGraphic != null && m_BackgroundGraphic.color != m_BackgroundColor)
				{
					m_BackgroundColor = m_BackgroundGraphic.color;
				}
				return m_BackgroundColor;
			}
			set
			{
				m_BackgroundColor = value;
				if (m_BackgroundGraphic != null)
				{
					m_BackgroundGraphic.color = m_BackgroundColor;
				}
			}
		}

		public RectTransform sliderHandleTransform
		{
			get
			{
				return m_SliderHandleTransform;
			}
			set
			{
				m_SliderHandleTransform = value;
			}
		}

		public Graphic handleGraphic
		{
			get
			{
				return m_HandleGraphic;
			}
			set
			{
				m_HandleGraphic = value;
				if ((bool)m_HandleGraphic)
				{
					m_HandleGraphic.color = ((!m_Interactable) ? m_DisabledColor : m_EnabledColor);
				}
			}
		}

		public RectTransform handleGraphicTransform
		{
			get
			{
				if (m_HandleGraphicTransform == null && m_HandleGraphic != null)
				{
					m_HandleGraphicTransform = m_HandleGraphic.rectTransform;
				}
				return m_HandleGraphicTransform;
			}
		}

		public RectTransform popupTransform
		{
			get
			{
				return m_PopupTransform;
			}
			set
			{
				m_PopupTransform = value;
			}
		}

		public Text popupText
		{
			get
			{
				return m_PopupText;
			}
			set
			{
				m_PopupText = value;
			}
		}

		public Text valueText
		{
			get
			{
				return m_ValueText;
			}
			set
			{
				m_ValueText = value;
			}
		}

		public MaterialInputField inputField
		{
			get
			{
				return m_InputField;
			}
			set
			{
				m_InputField = value;
			}
		}

		public RectTransform fillTransform
		{
			get
			{
				return m_FillTransform;
			}
			set
			{
				m_FillTransform = value;
			}
		}

		public Graphic backgroundGraphic
		{
			get
			{
				return m_BackgroundGraphic;
			}
			set
			{
				m_BackgroundGraphic = value;
				if (m_BackgroundGraphic != null)
				{
					m_BackgroundGraphic.color = m_BackgroundColor;
				}
			}
		}

		public RectTransform leftContentTransform
		{
			get
			{
				return m_LeftContentTransform;
			}
			set
			{
				m_LeftContentTransform = value;
			}
		}

		public RectTransform rightContentTransform
		{
			get
			{
				return m_RightContentTransform;
			}
			set
			{
				m_RightContentTransform = value;
			}
		}

		public RectTransform sliderContentTransform
		{
			get
			{
				return m_SliderContentTransform;
			}
			set
			{
				m_SliderContentTransform = value;
			}
		}

		public RectTransform rectTransform
		{
			get
			{
				return m_RectTransform;
			}
			set
			{
				m_RectTransform = value;
			}
		}

		public VectorImageData dotTemplateIcon
		{
			get
			{
				return m_DotTemplateIcon;
			}
			set
			{
				m_DotTemplateIcon = value;
			}
		}

		public RectTransform fillAreaTransform
		{
			get
			{
				if (m_FillAreaTransform == null && m_FillTransform != null)
				{
					m_FillAreaTransform = (m_FillTransform.parent as RectTransform);
				}
				return m_FillAreaTransform;
			}
		}

		public Slider slider
		{
			get
			{
				if (m_Slider == null)
				{
					m_Slider = GetComponent<Slider>();
				}
				return m_Slider;
			}
		}

		public CanvasGroup canvasGroup
		{
			get
			{
				if (m_CanvasGroup == null)
				{
					m_CanvasGroup = GetComponent<CanvasGroup>();
				}
				return m_CanvasGroup;
			}
		}

		public Canvas rootCanvas
		{
			get
			{
				if (m_RootCanvas == null)
				{
					MaterialUIScaler parentScaler = MaterialUIScaler.GetParentScaler(base.transform);
					if (parentScaler != null)
					{
						m_RootCanvas = parentScaler.targetCanvas;
					}
				}
				return m_RootCanvas;
			}
		}

		public bool isSelected => m_IsSelected;

		public bool hasManualPreferredWidth
		{
			get
			{
				return m_HasManualPreferredWidth;
			}
			set
			{
				m_HasManualPreferredWidth = value;
				CalculateLayoutInputHorizontal();
				SetLayoutHorizontal();
			}
		}

		public float manualPreferredWidth
		{
			get
			{
				return m_ManualPreferredWidth;
			}
			set
			{
				m_ManualPreferredWidth = value;
				CalculateLayoutInputHorizontal();
				SetLayoutHorizontal();
			}
		}

		public bool interactable
		{
			get
			{
				return m_Interactable;
			}
			set
			{
				m_Interactable = value;
				slider.interactable = value;
				canvasGroup.interactable = value;
				canvasGroup.blocksRaycasts = value;
				if ((bool)m_InputField)
				{
					m_InputField.GetComponent<MaterialInputField>().interactable = value;
				}
			}
		}

		public bool lowLeftDisabledOpacity
		{
			get
			{
				return m_LowLeftDisabledOpacity;
			}
			set
			{
				m_LowLeftDisabledOpacity = value;
				if ((bool)m_LeftContentTransform)
				{
					leftCanvasGroup.alpha = ((!m_LowLeftDisabledOpacity) ? 1f : ((!m_Interactable) ? 0.5f : 1f));
				}
			}
		}

		public bool lowRightDisabledOpacity
		{
			get
			{
				return m_LowRightDisabledOpacity;
			}
			set
			{
				m_LowRightDisabledOpacity = value;
				if ((bool)m_RightContentTransform)
				{
					rightCanvasGroup.alpha = ((!m_LowRightDisabledOpacity) ? 1f : ((!m_Interactable) ? 0.5f : 1f));
				}
			}
		}

		public CanvasGroup leftCanvasGroup
		{
			get
			{
				if (m_LeftCanvasGroup == null && m_LeftContentTransform != null)
				{
					m_LeftCanvasGroup = m_LeftContentTransform.gameObject.GetAddComponent<CanvasGroup>();
				}
				return m_LeftCanvasGroup;
			}
		}

		public CanvasGroup rightCanvasGroup
		{
			get
			{
				if (m_RightCanvasGroup == null && m_RightContentTransform != null)
				{
					m_RightCanvasGroup = m_RightContentTransform.gameObject.GetAddComponent<CanvasGroup>();
				}
				return m_RightCanvasGroup;
			}
		}

		public float minWidth => -1f;

		public float preferredWidth => (!m_HasManualPreferredWidth) ? (-1f) : m_Width;

		public float flexibleWidth => -1f;

		public float minHeight => -1f;

		public float preferredHeight => m_Height;

		public float flexibleHeight => -1f;

		public int layoutPriority => -1;

		protected override void OnEnable()
		{
			SetTracker();
		}

		protected override void OnDisable()
		{
			m_Tracker.Clear();
		}

		protected override void Start()
		{
			if (!Application.isPlaying)
			{
				SetTracker();
			}
			if (m_InputField != null)
			{
				if (slider.wholeNumbers)
				{
					m_InputField.inputField.contentType = InputField.ContentType.IntegerNumber;
				}
				else
				{
					m_InputField.inputField.contentType = InputField.ContentType.DecimalNumber;
				}
			}
		}

		private void SetTracker()
		{
			m_Tracker.Clear();
			m_Tracker.Add(this, m_SliderContentTransform, DrivenTransformProperties.AnchorMinX);
			m_Tracker.Add(this, m_SliderContentTransform, DrivenTransformProperties.AnchorMaxX);
			m_Tracker.Add(this, m_SliderContentTransform, DrivenTransformProperties.AnchoredPositionX);
			m_Tracker.Add(this, m_SliderContentTransform, DrivenTransformProperties.SizeDeltaX);
		}

		private void Update()
		{
			if (TweenManager.TweenIsActive(m_HandleAnchorMinTweener))
			{
				RectTransform fillTransform = m_FillTransform;
				float width = fillAreaTransform.rect.width;
				Vector2 anchorMin = handleGraphicTransform.anchorMin;
				fillTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, 0f, width * anchorMin.x);
			}
			if (m_InputField != null)
			{
				if (slider.wholeNumbers)
				{
					m_InputField.inputField.contentType = InputField.ContentType.IntegerNumber;
				}
				else
				{
					m_InputField.inputField.contentType = InputField.ContentType.DecimalNumber;
				}
			}
			if (!m_IsSelected)
			{
				return;
			}
			if (slider.wholeNumbers && m_HasDots)
			{
				if (m_NumberOfDots != SliderValueRange())
				{
					RebuildDots();
				}
				for (int i = 0; i < m_DotGraphics.Length; i++)
				{
					if (slider.value > (float)i)
					{
						m_DotGraphics[i].color = m_EnabledColor;
					}
					else
					{
						m_DotGraphics[i].color = m_BackgroundColor;
					}
				}
			}
			else
			{
				DestroyDots();
			}
			if ((bool)m_HandleGraphic)
			{
				m_HandleGraphic.color = ((!m_Interactable) ? m_DisabledColor : m_EnabledColor);
			}
		}

		private void DestroyDots()
		{
			for (int i = 0; i < m_DotGraphics.Length; i++)
			{
				if (m_DotGraphics[i] != null)
				{
					if (Application.isPlaying)
					{
						UnityEngine.Object.Destroy(m_DotGraphics[i].gameObject);
					}
					else
					{
						UnityEngine.Object.DestroyImmediate(m_DotGraphics[i].gameObject);
					}
				}
			}
			m_NumberOfDots = -1;
			m_DotGraphics = new Graphic[0];
		}

		private void RebuildDots()
		{
			DestroyDots();
			m_NumberOfDots = SliderValueRange();
			float num = 1f / (float)m_NumberOfDots;
			m_DotGraphics = new Graphic[m_NumberOfDots + 1];
			for (int i = 0; i < m_DotGraphics.Length; i++)
			{
				m_DotGraphics[i] = CreateDot();
				m_DotGraphics[i].rectTransform.SetAnchorX(num * (float)i, num * (float)i);
				if (slider.value > (float)i)
				{
					m_DotGraphics[i].color = ((!m_Interactable) ? m_DisabledColor : m_EnabledColor);
				}
				else
				{
					m_DotGraphics[i].color = m_BackgroundColor;
				}
			}
		}

		private int SliderValueRange()
		{
			return Mathf.RoundToInt(slider.maxValue - slider.minValue);
		}

		private Graphic CreateDot()
		{
			RectTransform component = PrefabManager.InstantiateGameObject("SliderDot", m_SliderContentTransform).GetComponent<RectTransform>();
			component.SetSiblingIndex(1);
			component.anchoredPosition = Vector2.zero;
			component.anchoredPosition = new Vector2(0f, 0.5f);
			return component.GetComponent<Graphic>();
		}

		private void AnimateOn()
		{
			TweenManager.EndTween(m_HandleSizeTweener);
			TweenManager.EndTween(m_PopupScaleTweener);
			TweenManager.EndTween(m_HandlePositionYTweener);
			TweenManager.EndTween(m_PopupTextColorTweener);
			if (m_HasPopup)
			{
				m_HandleSizeTweener = TweenManager.TweenVector2(delegate(Vector2 vector2)
				{
					handleGraphicTransform.sizeDelta = vector2;
				}, handleGraphicTransform.sizeDelta, new Vector2(38f, 38f), m_AnimationDuration, 0f, null, scaledTime: false, Tween.TweenType.SoftEaseOutQuint);
				Action<float> updateValue = delegate(float f)
				{
					RectTransform handleGraphicTransform = m_HandleGraphicTransform;
					Vector2 anchoredPosition2 = m_HandleGraphicTransform.anchoredPosition;
					handleGraphicTransform.anchoredPosition = new Vector2(anchoredPosition2.x, f);
				};
				Vector2 anchoredPosition = m_HandleGraphicTransform.anchoredPosition;
				m_HandlePositionYTweener = TweenManager.TweenFloat(updateValue, anchoredPosition.y, (!slider.wholeNumbers || !m_HasDots) ? 30 : 36, m_AnimationDuration, 0f, null, scaledTime: false, Tween.TweenType.EaseOutSept);
				m_PopupScaleTweener = TweenManager.TweenVector3(delegate(Vector3 vector3)
				{
					m_PopupTransform.localScale = vector3;
				}, m_PopupTransform.localScale, Vector3.one, m_AnimationDuration, 0f, null, scaledTime: false, Tween.TweenType.EaseOutSept);
			}
			else
			{
				m_HandleSizeTweener = TweenManager.TweenVector2(delegate(Vector2 vector2)
				{
					handleGraphicTransform.sizeDelta = vector2;
				}, handleGraphicTransform.sizeDelta, new Vector2(24f, 24f), m_AnimationDuration, 0f, null, scaledTime: false, Tween.TweenType.SoftEaseOutQuint);
			}
			m_PopupTextColorTweener = TweenManager.TweenColor(delegate(Color color)
			{
				m_PopupText.color = color;
			}, () => m_PopupText.color, () => m_PopupText.color.WithAlpha(1f), m_AnimationDuration * 0.66f, m_AnimationDuration * 0.33f);
		}

		private void AnimateOff()
		{
			TweenManager.EndTween(m_HandleSizeTweener);
			TweenManager.EndTween(m_PopupScaleTweener);
			TweenManager.EndTween(m_HandlePositionYTweener);
			TweenManager.EndTween(m_PopupTextColorTweener);
			if (m_HasPopup)
			{
				Action<float> updateValue = delegate(float f)
				{
					RectTransform handleGraphicTransform = m_HandleGraphicTransform;
					Vector2 anchoredPosition2 = m_HandleGraphicTransform.anchoredPosition;
					handleGraphicTransform.anchoredPosition = new Vector2(anchoredPosition2.x, f);
				};
				Vector2 anchoredPosition = m_HandleGraphicTransform.anchoredPosition;
				m_HandlePositionYTweener = TweenManager.TweenFloat(updateValue, anchoredPosition.y, (!MaterialUIScaler.GetParentScaler(base.transform).targetCanvas.pixelPerfect) ? 0f : 1f, m_AnimationDuration, 0f, null, scaledTime: false, Tween.TweenType.EaseOutCubed);
				m_PopupScaleTweener = TweenManager.TweenVector3(delegate(Vector3 vector3)
				{
					m_PopupTransform.localScale = vector3;
				}, m_PopupTransform.localScale, Vector3.zero, m_AnimationDuration);
			}
			m_HandleSizeTweener = TweenManager.TweenVector2(delegate(Vector2 vector2)
			{
				handleGraphicTransform.sizeDelta = vector2;
			}, handleGraphicTransform.sizeDelta, new Vector2(16f, 16f), m_AnimationDuration, 0f, null, scaledTime: false, Tween.TweenType.EaseOutSept);
			m_PopupTextColorTweener = TweenManager.TweenColor(delegate(Color color)
			{
				m_PopupText.color = color;
			}, m_PopupText.color, m_PopupText.color.WithAlpha(0f), m_AnimationDuration * 0.25f);
		}

		public void OnInputChange(string value)
		{
			if (float.TryParse(value, out float result))
			{
				m_CurrentInputValue = result;
				if (result >= slider.minValue && result <= slider.maxValue)
				{
					slider.value = result;
				}
			}
		}

		public void OnInputEnd()
		{
			if (m_InputField != null)
			{
				slider.value = m_CurrentInputValue;
				m_InputField.inputField.text = slider.value.ToString();
			}
		}

		public void OnSliderValueChanged(float value)
		{
			TweenManager.EndTween(m_HandleAnchorMinTweener);
			TweenManager.EndTween(m_HandleAnchorMaxTweener);
			if (slider.wholeNumbers && SliderValueRange() < 100)
			{
				Action<float> updateValue = delegate(float f)
				{
					RectTransform handleGraphicTransform3 = this.handleGraphicTransform;
					Vector2 anchorMin5 = this.handleGraphicTransform.anchorMin;
					handleGraphicTransform3.anchorMin = new Vector2(f, anchorMin5.y);
				};
				Vector2 anchorMin = this.handleGraphicTransform.anchorMin;
				float x = anchorMin.x;
				Vector2 anchorMin2 = m_Slider.handleRect.anchorMin;
				m_HandleAnchorMinTweener = TweenManager.TweenFloat(updateValue, x, anchorMin2.x, m_AnimationDuration * 0.5f, 0f, null, scaledTime: false, Tween.TweenType.EaseOutSept);
				Action<float> updateValue2 = delegate(float f)
				{
					RectTransform handleGraphicTransform2 = this.handleGraphicTransform;
					Vector2 anchorMax4 = this.handleGraphicTransform.anchorMax;
					handleGraphicTransform2.anchorMax = new Vector2(f, anchorMax4.y);
				};
				Vector2 anchorMax = this.handleGraphicTransform.anchorMax;
				float x2 = anchorMax.x;
				Vector2 anchorMax2 = m_Slider.handleRect.anchorMax;
				m_HandleAnchorMaxTweener = TweenManager.TweenFloat(updateValue2, x2, anchorMax2.x, m_AnimationDuration * 0.5f, 0f, null, scaledTime: false, Tween.TweenType.EaseOutSept);
			}
			else
			{
				Vector2 vector = this.handleGraphicTransform.anchorMin;
				Vector2 anchorMin3 = m_Slider.handleRect.anchorMin;
				vector.x = anchorMin3.x;
				this.handleGraphicTransform.anchorMin = vector;
				vector = this.handleGraphicTransform.anchorMax;
				Vector2 anchorMax3 = m_Slider.handleRect.anchorMax;
				vector.x = anchorMax3.x;
				this.handleGraphicTransform.anchorMax = vector;
				RectTransform handleGraphicTransform = this.handleGraphicTransform;
				Vector2 anchoredPosition = this.handleGraphicTransform.anchoredPosition;
				handleGraphicTransform.anchoredPosition = new Vector2(0f, anchoredPosition.y);
			}
			RectTransform fillTransform = m_FillTransform;
			float width = fillAreaTransform.rect.width;
			Vector2 anchorMin4 = m_HandleGraphicTransform.anchorMin;
			fillTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, 0f, width * anchorMin4.x);
			m_PopupText.text = slider.value.ToString("#0.#");
			if (m_ValueText != null)
			{
				m_ValueText.text = slider.value.ToString("#0.##");
			}
			if (m_InputField != null)
			{
				m_InputField.inputField.text = slider.value.ToString("#0.##");
			}
		}

		public void OnBeforeValidate()
		{
			if ((bool)m_BackgroundGraphic)
			{
				m_BackgroundColor = m_BackgroundGraphic.color;
			}
		}

		public void UpdateColors()
		{
			if ((bool)m_BackgroundGraphic)
			{
				m_BackgroundGraphic.color = m_BackgroundColor;
			}
			if ((bool)m_HandleGraphic)
			{
				m_HandleGraphic.color = ((!m_Interactable) ? m_DisabledColor : m_EnabledColor);
			}
			for (int i = 0; i < m_DotGraphics.Length; i++)
			{
				if (!(m_DotGraphics[i] == null))
				{
					if (slider.value > (float)i)
					{
						m_DotGraphics[i].color = ((!m_Interactable) ? m_DisabledColor : m_EnabledColor);
					}
					else
					{
						m_DotGraphics[i].color = m_BackgroundColor;
					}
				}
			}
			if ((bool)m_LeftContentTransform)
			{
				leftCanvasGroup.alpha = ((!m_LowLeftDisabledOpacity) ? 1f : ((!m_Interactable) ? 0.5f : 1f));
			}
			if ((bool)m_RightContentTransform)
			{
				rightCanvasGroup.alpha = ((!m_LowRightDisabledOpacity) ? 1f : ((!m_Interactable) ? 0.5f : 1f));
			}
		}

		protected override void OnRectTransformDimensionsChange()
		{
			base.OnRectTransformDimensionsChange();
			SetLayoutHorizontal();
		}

		protected override void OnTransformParentChanged()
		{
			base.OnTransformParentChanged();
			SetLayoutHorizontal();
		}

		public void OnPointerDown(PointerEventData eventData)
		{
			AnimateOn();
		}

		public void OnPointerUp(PointerEventData eventData)
		{
			AnimateOff();
		}

		public void OnSelect(BaseEventData eventData)
		{
			AnimateOn();
			m_IsSelected = true;
		}

		public void OnDeselect(BaseEventData eventData)
		{
			AnimateOff();
			m_IsSelected = false;
		}

		public void CalculateLayoutInputHorizontal()
		{
			if ((bool)m_LeftContentTransform)
			{
				ILayoutElement[] componentsInChildren = m_LeftContentTransform.GetComponentsInChildren<ILayoutElement>();
				componentsInChildren = componentsInChildren.Reverse().ToArray();
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					componentsInChildren[i].CalculateLayoutInputHorizontal();
				}
				m_LeftWidth = LayoutUtility.GetPreferredWidth(m_LeftContentTransform) + 16f;
			}
			if ((bool)m_RightContentTransform)
			{
				ILayoutElement[] componentsInChildren2 = m_RightContentTransform.GetComponentsInChildren<ILayoutElement>();
				componentsInChildren2 = componentsInChildren2.Reverse().ToArray();
				for (int j = 0; j < componentsInChildren2.Length; j++)
				{
					componentsInChildren2[j].CalculateLayoutInputHorizontal();
				}
				m_RightWidth = LayoutUtility.GetPreferredWidth(m_RightContentTransform) + 16f;
			}
			else
			{
				m_RightWidth = 0f;
			}
			m_Width = Mathf.Max(m_ManualPreferredWidth, m_LeftWidth + m_RightWidth + ((!slider.wholeNumbers || !m_HasDots) ? 0f : 6f));
		}

		public void SetLayoutHorizontal()
		{
			SetTracker();
			if ((bool)m_LeftContentTransform)
			{
				ILayoutController[] componentsInChildren = m_LeftContentTransform.GetComponentsInChildren<ILayoutController>();
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					componentsInChildren[i].SetLayoutHorizontal();
				}
			}
			if ((bool)m_RightContentTransform)
			{
				ILayoutController[] componentsInChildren2 = m_RightContentTransform.GetComponentsInChildren<ILayoutController>();
				for (int j = 0; j < componentsInChildren2.Length; j++)
				{
					componentsInChildren2[j].SetLayoutHorizontal();
				}
			}
			RectTransform sliderContentTransform = m_SliderContentTransform;
			Vector2 anchorMin = m_SliderContentTransform.anchorMin;
			sliderContentTransform.anchorMin = new Vector2(0f, anchorMin.y);
			RectTransform sliderContentTransform2 = m_SliderContentTransform;
			Vector2 anchorMax = m_SliderContentTransform.anchorMax;
			sliderContentTransform2.anchorMax = new Vector2(1f, anchorMax.y);
			RectTransform sliderContentTransform3 = m_SliderContentTransform;
			float x = m_LeftWidth + ((!slider.wholeNumbers || !m_HasDots) ? 0f : 3f);
			Vector2 anchoredPosition = m_SliderContentTransform.anchoredPosition;
			sliderContentTransform3.anchoredPosition = new Vector2(x, anchoredPosition.y);
			RectTransform sliderContentTransform4 = m_SliderContentTransform;
			float x2 = 0f - (m_LeftWidth + m_RightWidth) - ((!slider.wholeNumbers || !m_HasDots) ? 0f : 6f);
			Vector2 sizeDelta = m_SliderContentTransform.sizeDelta;
			sliderContentTransform4.sizeDelta = new Vector2(x2, sizeDelta.y);
		}

		public void CalculateLayoutInputVertical()
		{
			float a = 0f;
			float b = 0f;
			if ((bool)m_LeftContentTransform)
			{
				ILayoutElement[] componentsInChildren = m_LeftContentTransform.GetComponentsInChildren<ILayoutElement>();
				componentsInChildren = componentsInChildren.Reverse().ToArray();
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					componentsInChildren[i].CalculateLayoutInputVertical();
				}
				a = LayoutUtility.GetPreferredHeight(m_LeftContentTransform);
			}
			if ((bool)m_RightContentTransform)
			{
				ILayoutElement[] componentsInChildren2 = m_RightContentTransform.GetComponentsInChildren<ILayoutElement>();
				componentsInChildren2 = componentsInChildren2.Reverse().ToArray();
				for (int j = 0; j < componentsInChildren2.Length; j++)
				{
					componentsInChildren2[j].CalculateLayoutInputVertical();
				}
				b = LayoutUtility.GetPreferredHeight(m_RightContentTransform);
			}
			m_Height = Mathf.Max(LayoutUtility.GetPreferredHeight(m_SliderContentTransform), Mathf.Max(a, b));
			m_Height = Mathf.Max(m_Height, 24f);
		}

		public void SetLayoutVertical()
		{
			if ((bool)m_LeftContentTransform)
			{
				ILayoutController[] componentsInChildren = m_LeftContentTransform.GetComponentsInChildren<ILayoutController>();
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					componentsInChildren[i].SetLayoutVertical();
				}
			}
			if ((bool)m_RightContentTransform)
			{
				ILayoutController[] componentsInChildren2 = m_RightContentTransform.GetComponentsInChildren<ILayoutController>();
				for (int j = 0; j < componentsInChildren2.Length; j++)
				{
					componentsInChildren2[j].SetLayoutVertical();
				}
			}
			if (rootCanvas != null && !m_IsSelected)
			{
				Vector2 anchoredPosition = m_HandleGraphic.rectTransform.anchoredPosition;
				anchoredPosition.y = ((!rootCanvas.pixelPerfect) ? 0f : 1f);
				m_HandleGraphic.rectTransform.anchoredPosition = anchoredPosition;
			}
		}
	}
}
